local skel = fk.CreateSkill {
  name = "emo__huamo",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["emo__huamo"] = "化魔",
  [":emo__huamo"] = "锁定技，游戏开始时，你废除判定区和装备区，将八张<a href=':kill_demon'>【除魔】</a>洗入牌堆。",
}

skel:addEffect(fk.GameStart, {
  anim_type = "negative",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local eqipSlots = player:getAvailableEquipSlots()
    if not table.contains(player.sealedSlots, Player.JudgeSlot) then
      table.insert(eqipSlots, Player.JudgeSlot)
    end
    room:abortPlayerArea(player, eqipSlots)
    local cards = {}
    for _, card in ipairs(Fk.cards) do
      if card.name == "kill_demon" and card.suit ~= Card.NoSuit then
        table.insert(cards, room:printCard(card.name, card.suit, card.number).id)
      end
    end
    if #cards == 0 then return end

    table.shuffle(cards)
    local positions = {}
    local y = #room.draw_pile
    for _ = 1, #cards, 1 do
      table.insert(positions, math.random(y+1))
    end
    table.sort(positions, function (a, b) return a > b end)
    local moveInfos = {}
    for i = 1, #cards, 1 do
      table.insert(moveInfos, {
        ids = {cards[i]},
        toArea = Card.DrawPile,
        moveReason = fk.ReasonJustMove,
        skillName = skel.name,
        drawPilePosition = positions[i],
      })
    end
    room:moveCards(table.unpack(moveInfos))
  end,
})

return skel
